package com.ml.ws.service;

import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.commons.lang.BooleanUtils;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import com.ml.ws.bo.AgentCustInfo;
import com.ml.ws.bo.AgentCustInfoList;

@Controller
@RequestMapping(value = "/query")
public class QueryController {

	private Logger logger = Logger.getLogger(getClass());

	@Autowired
	private CommonService commonService;

	@RequestMapping(value = "/test/{reqMsg}", method = {RequestMethod.POST, RequestMethod.GET})
	public AgentCustInfoList test(@PathVariable String reqMsg,
			HttpServletRequest request, HttpServletResponse response)
			throws Exception {

		logger.info(reqMsg);

		AgentCustInfoList rl = new AgentCustInfoList();
		
		rl.setPage_num(1);
		rl.setPage_size(10);
		rl.setTotal_num(10);
		
		List<AgentCustInfo> result = null;

//		String member_id = "0001";
		String member_id = reqMsg;

		try {
			result = commonService.queryAgentCustInfo(member_id, null, null,
					null, null, null, 1, 10, BooleanUtils.toBoolean(1));

		} catch (Exception e) {
			logger.error(e.getMessage(), e);
		}

		rl.setAgentCustInfo(result);

		return rl;
	}


}
